#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
from os.path import abspath, dirname, join
import logging

sys.path.insert(0, abspath(dirname(__file__)))
sys.path.insert(0, abspath(join(dirname(__file__), "depend/")))
sys.path.insert(0, abspath(join(dirname(__file__), "module/")))

#log_level = logging.DEBUG
log_level = logging.ERROR

logging.basicConfig(level=log_level,
                    format='[%(levelname)s][%(asctime)s][%(process)d][%(filename)s:%(lineno)d][%(funcName)s] %(message)s',
                    filename=abspath(join(dirname(__file__), "log/site.log")),
                    filemode='a+')


DATABASE = {
    'engine' : 'sqlite3',
    'db' : abspath(join(dirname(__file__), "data.db")),
}

#网站根域名
ROOT_DOMAIN = 'test.com'

#session相关
SECRET_KEY = 'secret_key_for_test'
SESSION_MAX_AGE = 7200

#管理员邮箱列表
ADMIN_EMAIL_LIST = ['zny2008@gmail.com']

#指定的模板路径
CUSTOM_TPL_PATH = abspath(join(dirname(__file__), "views/"))

#静态文件
STATIC_FILE_PATH = abspath(join(dirname(__file__), "static/"))

#上传图片
ENTRY_FILE_PATH = abspath(join(dirname(__file__), "entry_store/"))

#通过entry_id计算存放路径
ENTRY_DIR_FUNC = lambda x: '%u/%u/' % (x%100, x/100%100)
